<?php
 /*******************************************************************************
 * @filename: add.ctp
 *
 * @author: immer_baldos
 *
 * @description: orders/add view
 *
 * @history:
 *
 *   VERSION   DATE                   BY          NOTES
 *  ---------------------------------------------------------------
 *     1.0     September  9, 2009     immer       initial bake
 *
 *     2.0     September 16, 2009     immer       add role based menus
 *
 ******************************************************************************/
 ?>
<div class="orders form">
<?php echo $form->create('Order');?>
	<fieldset>
 		<legend><?php __('Add Order');?></legend>
	<?php
	    echo $form->input('id');
        if ($_SESSION['Auth']['User']['role'] == "customer"){
		    echo $form->hidden('customer_id',array('value'=> $_SESSION['Auth']['User']['customer_id']));
		    echo $form->hidden('order_number',array('default'=>sprintf("%s%'03s%'02s%'02s%'02s",$timestamp['year'],$timestamp['yday'],$timestamp['hours'],$timestamp['minutes'],$timestamp['seconds'])));
		}else{
		    echo $form->input('customer_id');
		    echo $form->input('order_number',array('default'=>sprintf("%s%'03s%'02s%'02s%'02s",$timestamp['year'],$timestamp['yday'],$timestamp['hours'],$timestamp['minutes'],$timestamp['seconds'])));
		}
		echo $form->hidden('print_count',array('value'=>'0'));
		echo $form->hidden('print_date',array('default'=>'00-00-0000'));
		echo $form->hidden('created_by',array('value'=>$_SESSION['Auth']['User']['username']));
		echo $form->input('ship_via');
		echo $form->input('sales_terms');
		echo $form->input('sales_person');
		echo $form->input('delivery_date');
		echo $form->hidden('approved', array('value' => 0));
		echo $form->hidden('assigned_to',array('value'=>'EMPTY'));
	?>
	</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
	<ul>
		<li><?php echo $html->link(__('List Orders', true), array('action' => 'index'));?></li>
		<li><?php echo $html->link(__('List Customers', true), array('controller' => 'customers', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Customer', true), array('controller' => 'customers', 'action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Payments', true), array('controller' => 'payments', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Payment', true), array('controller' => 'payments', 'action' => 'add')); ?> </li>
		<li><?php echo $html->link(__('List Transactions', true), array('controller' => 'transactions', 'action' => 'index')); ?> </li>
		<li><?php echo $html->link(__('New Transaction', true), array('controller' => 'transactions', 'action' => 'add')); ?> </li>
	</ul>
</div>
